package com.sdg.offline

import com.sdg.offline.AlsTrainer.computeRmse
import org.apache.spark.SparkConf
import org.apache.spark.mllib.recommendation.{ALS, Rating}
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.SparkSession

object GT {
  def main(args: Array[String]): Unit = {
    /*  val spark = SparkSession.builder().config(new SparkConf().setAppName("GT").setMaster("local")).getOrCreate()
      val rdd = spark.sparkContext.parallelize(List("电影a","电影b","电影c"))
      val rdd01 = rdd.cartesian(rdd).filter( line=>{line._1!=line._2})
      rdd01.foreach(println(_))
      spark.stop()*/
    //嵌套循环
    /*for (rank <- Array(10, 50); lambda <- Array(1.0, 0.0001); alpha <- Array(1.0, 40.0)) {
      //模型
      println((rank, lambda, alpha))
    }*/

  /*  for (i <- 0 to 10) {
      for (j <- 0 to 10) {
        println(i)
      }
    }*/
    val arr=for (i <- 0 to 10; j <- 0 to 10 if(j==1)) yield {
      println(i+"  ----  "+j)
      (i,j)
    }

    arr
  }

}
